package com.game.comment.core;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {
    private int status;
    private String msg;
    private T data;

    public ResponseResult(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public static <T>  ResponseResult<T> success (String msg, T data)
    {
        return new ResponseResult<>(1, msg,data);
    }
    public static <T> ResponseResult<T> success (T data)
    {
        return new ResponseResult<T>(1, "ok",data);
    }
    public static <T> ResponseResult<T> success (String msg)
    {
        return new ResponseResult<T>(1, msg);
    }
    public static ResponseResult<?> success ()
    {
        return new ResponseResult<>(1, "ok",null);
    }

    public static ResponseResult<?> error (String msg)
    {
        return new ResponseResult<>(999, msg,null);
    }

    public static ResponseResult<?> error (String msg,Object data)
    {
        return new ResponseResult<>(999, msg,data);
    }
    public static ResponseResult<?> error (Object data)
    {
        return new ResponseResult<>(999, "error",data);
    }
}
